home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / FAQ.SWG / 0027_DOS Proramming FAQ.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-26  |  4KB  |  100 lines

  1. SECTION 7 - DOS Programming
  2.                            
  3. This document contains information that is most often provided
  4. to users of this section.  There is a listing of common
  5. Technical Information Documents that can be downloaded from the
  6. libraries, and a listing of the five most frequently asked
  7. questions and their answers.
  8.          
  9. TI1184   Overview of Borland Pascal 7.0 and Turbo Pascal 7.0
  10. TI1722   Declaring an array on the heap
  11. TI1760   Creating a temporary stack in real or protected mode
  12. TI1171   Problem Report Form
  13. TI1719   Booting Clean
  14.  
  15. LC2P01.FAQ   Linking C to Pascal  Frequently Asked Questions
  16. EZDPMI.ZIP   Unit encapsulating common DPMI requests for
  17.              protected mode programming 
  18. BIGSTU.PAS   How to cope with memory allocations > 64K 
  19. PASALL.ZIP   Collection of Technical Information Sheets from 
  20.              1986 on
  21. NEWRTM.ZIP   Latest RMT.EXE and DPMI16BI.OVL
  22. MOUSE.ZIP    General purpose mouse unit for text/graphic modes
  23.  
  24. Q.   "How do I link an object file that is a library of
  25.      functions created in C?"
  26.  
  27. A.   Download the file "LC2P01.FAQ.  The C run-time library is
  28.      needed by the object file.  Since Pascal can't link the C
  29.      RTL as is, you will need the RTL source and will need to
  30.      modify it so that it can be linked by TP.
  31.  
  32. Q.   "How do I get the ASCII key numbers for the Arrow keys?"
  33.  
  34. A.   Below is a short program that reveals this information.
  35.  
  36.      program DisplayAscii;
  37.      uses Crt;
  38.      var
  39.        ch:char;
  40.      begin
  41.        repeat               { repeat until Ctrl-C }
  42.             ch := Readkey;
  43.             Write(Ord(CH):4);
  44.        until ch = ^C;          
  45.      end.
  46.  
  47.      The program can be terminated by pressing Ctrl-C.  You'll
  48.      see that keypresses such as UpArrow actually generated two
  49.      bytes:  a zero followed by the extended key code. 
  50.  
  51. Q.   "Why do I get runtime error 4 while using the following
  52.      line:  reset(InFile)?"
  53.  
  54. A.   The error message means that you have run out of file
  55.      handles.  The FILES= statement in your CONFIG.SYS doesn't
  56.      change the fact that a process can, by default, open a
  57.      maximum of 20 files (and DOS grabs 5 of those).  The
  58.      SetHandleCount() API function can be used to increase the
  59.      number of handles useable by your application.
  60.  
  61. Q.   "I am using overlays with BP7 with Objects.  If Overlay A
  62.      calls a procedure or function in Overlay B, does Overlay A
  63.      stay in memory while Overlay B runs?  Or does Overlay B
  64.      wipe out Overlay A, and when Overlay B finishes, it reloads
  65.      Overlay A?"
  66.  
  67. A.   It depends on the size of the overlays and the size of the
  68.      overlay buffer you set up.  In general you can think of the
  69.      overlay buffer as a pool of memory where overlaid units can
  70.      be stored.  Every time you call a routine in an overlaid
  71.      unit, that overlay is loaded into the buffer.  If the
  72.      buffer is already full, then the oldest unit in the buffer
  73.      is discarded to make room for the new one.  If you've got a
  74.      small overlay buffer and large overlaid units, they may
  75.      well kick each other out as they load.  If you've got a
  76.      large overlay buffer the program may well keep everything
  77.      in memory the entire time.
  78.  
  79. Q.   "I am getting DosError = 8 when using EXEC() to execute a 
  80.      program from within my program.  How do I correct this?"
  81.  
  82. A.   DosError = 8 means that there is not enough memory 
  83.      available to run the program being EXEC'ed.  Normally your
  84.      program grabs all available memory and doesn't leave any 
  85.      for the program being EXEC'ed.  Be sure to use the $M 
  86.      directive which minimizes the memory required by your
  87.      program.  
  88.  
  89. Q.   "I am getting DosError = 2 when using EXEC() to copy a 
  90.      file from one directory to another.  The file does exist
  91.      and the command line is correct.  What is the problem?"
  92. A.   You might have assumed that because COMMAND.COM is on your
  93.      path, EXEC will find it.  Nope.  EXEC needs the full path
  94.      name.  You can use GetEnv('COMSPEC') to get the value of
  95.      the environment variable COMSPEC which should be the full
  96.      path.  
  97.      
  98.  
  99.  
  100.